package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.dao.IMiguMusicConfigDao;
import org.jsbd.boss.domian.MiguMusicConfigBean;
import org.springframework.stereotype.Repository;

@Repository("miguMusicConfigDao")
public class MiguMusicConfigDaoImpl extends CrackBaseDao implements IMiguMusicConfigDao {

	@Override
	public void saveMiguMusicConfig(MiguMusicConfigBean miguMusicConfig) {
		super.insert("migu_music_config.insert_migu_music_config", miguMusicConfig);
	}

	@Override
	public void updateMiguMusicConfig(MiguMusicConfigBean miguMusicConfig) {
		super.update("migu_music_config.update_migu_music_config", miguMusicConfig);
	}

	@Override
	public MiguMusicConfigBean getMiguMusicConfig(MiguMusicConfigBean miguMusicConfig) {
		return (MiguMusicConfigBean) super.queryForObject("migu_music_config.select_migu_music_config_one", miguMusicConfig);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<MiguMusicConfigBean> getMiguMusicConfigList(MiguMusicConfigBean miguMusicConfig) {
		return super.queryForList("migu_music_config.select_migu_music_config_list", miguMusicConfig);
	}

	@Override
	public Map<String, Object> getMiguMusicConfigListPage(DataGridModel page, MiguMusicConfigBean form) {
		form = (form == null ? new MiguMusicConfigBean() : form);
		form.setPageInfo(page);
		Map<String, Object> results = new HashMap<String, Object>();
		results.put("total", super.queryForCount("migu_music_config.select_migu_music_config_page_count", form));
		results.put("rows", super.queryForList("migu_music_config.select_migu_music_config_list", form));
		return results;
	}

	public Integer getMiguMusicConfigCount(MiguMusicConfigBean miguMusicConfig) {
		return super.queryForCount("migu_music_config.select_migu_music_config_page_count", miguMusicConfig);
	}

	public void deleteMiguMusicConfig(MiguMusicConfigBean miguMusicConfig){
		super.update("migu_music_config.del_migu_music_config", miguMusicConfig);
	}

	@Override
	public void updateMiguMusicStatus(MiguMusicConfigBean miguMusicConfig) {
		super.update("migu_music_config.update_migu_music_status", miguMusicConfig);
		
	}

	@Override
	public MiguMusicConfigBean getByName(String name) {
		return (MiguMusicConfigBean) super.queryForObject("migu_music_config.select_by_name", name);
	}

	@Override
	public void updateDaylimit(List<MiguMusicConfigBean> configs) {
		super.batchUpdate("migu_music_config.UPDATE_DAY_LIMIT", configs);
	}
	
}
